package cn.wolfcode.crm.service.impl;

import cn.wolfcode.crm.domain.Classinfo;
import cn.wolfcode.crm.mapper.ClassinfoMapper;
import cn.wolfcode.crm.query.QueryObject;
import cn.wolfcode.crm.service.IClassInfoService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class ClassInfoServiceImpl implements IClassInfoService {
    @Autowired
    private ClassinfoMapper classinfoMapper;
    @Override
    public void delete(Long id) {
        classinfoMapper.deleteByPrimaryKey(id);
    }

    @Override
    public void save(Classinfo record) {
        classinfoMapper.insert(record);
    }

    @Override
    public Classinfo get(Long id) {

        return classinfoMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<Classinfo> list() {

        return classinfoMapper.selectAll();
    }

    @Override
    public void update(Classinfo record) {

        classinfoMapper.updateByPrimaryKey(record);
    }

    @Override
    public PageInfo query(QueryObject qo) {
        PageHelper.startPage(qo.getCurrentPage(),qo.getPageSize());
        List<Classinfo> list = classinfoMapper.selectForlist(qo);
        return new PageInfo(list);
    }
}
